import React from 'react';
import { WeaLocaleProvider, WeaSearchGroup } from 'ecCom';
import EType from './base/EType';
import ETitle from './base/ETitle';
import DataSourceTable from './base/DataSourceTable';

const getLabel = WeaLocaleProvider.getLabel;

// 排行榜
class Content_RankingList extends React.Component {
  render() {
    const { hpid, eid, ebaseid, eBaseName, eTitle, eTabs, eShareLevel, synergyParams } = this.props;

    let __DataSourceTable = <div></div>;
    if (eShareLevel == '2') {
      __DataSourceTable = <DataSourceTable ecId={`${this && this.props && this.props.ecId || ''}_DataSourceTable@hk4nne`} ref="dataSourceTable" hpid={hpid} eid={eid} ebaseid={ebaseid} {...eTabs} synergyParams={synergyParams} />;
    }

    return (
      <div>
        <WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@ayz5mn`} title={getLabel(81711, '基本信息')} showGroup={true}>
          <EType ecId={`${this && this.props && this.props.ecId || ''}_EType@4wn0cq`} ref="eType" value={eBaseName} />
          {eShareLevel == '2' ? <ETitle ecId={`${this && this.props && this.props.ecId || ''}_ETitle@241ksv`} ref="eTitle" eid={eid}  value={eTitle}  {...this.props}/> : ''}
        </WeaSearchGroup>
        {__DataSourceTable}
      </div>
    );
  }

  getSaveValues() {
    return {
      eContentTitle: this.refs['eTitle'] ? this.refs['eTitle'].getSaveValues() : this.props.eTitle,
      eContentTabWidth: { tabwidth: this.props.etabwidth, methodvalue: this.props.methodvalue },
      eContenteTabStyle: { tabstyle: this.props.tabstyle, tabvalue: this.props.tabvalue, tabname: this.props.tabname },
      eTabs: this.refs['dataSourceTable'] ? this.refs['dataSourceTable'].getSaveValues() : {},
    };
  }
}

export default Content_RankingList;
